//
// Created by xiaoma on 1/28/21.
//

#ifndef HORSE_VM_HIINTEGER_H
#define HORSE_VM_HIINTEGER_H
#include "HiObject.h"
#include "Universe.h"

class IntegerKlass : public Klass {
public:
    static IntegerKlass *getKlass() {
        static IntegerKlass klass;
        return &klass;
    }

    virtual void print(HiObject *object);

    virtual HiObject *add(HiObject *lhs, HiObject *rhs);

    virtual HiBool *less(HiObject *lhs, HiObject *rhs);

    virtual HiBool *lessEqual(HiObject *lhs, HiObject *rhs);

    virtual HiBool *equal(HiObject *lhs, HiObject *rhs);

    virtual HiBool *notEqual(HiObject *lhs, HiObject *rhs);

    virtual HiBool *greater(HiObject *lhs, HiObject *rhs);

    virtual HiBool *greaterEqual(HiObject *lhs, HiObject *rhs);

private:
    IntegerKlass() {}
};

class HiInteger : public HiObject {
public:
    HiInteger(int val) : _value(val) {
        setKlass(IntegerKlass::getKlass());
    }

    int value() { return _value; }
private:
    int _value;
};

#endif //HORSE_VM_HIINTEGER_H
